package com.ruibang.glass.quality.feign;

import com.ruibang.glass.common.domain.file.FileBusiness;
import com.teaming.cloud.framework2.common.model.ResultBody;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@FeignClient("glass-file")
@Component
public interface FileApi {

    @RequestMapping(value = "/api/glass/file/updateBusinessById",method = RequestMethod.POST)
    ResultBody updateBusinessById(@RequestBody FileBusiness fileBusiness);

    @RequestMapping(value = "/api/glass/file/deleteByFileIds",method = RequestMethod.POST)
    RequestBody deleteByFileIds(@RequestBody List<String> fileIds);

    @RequestMapping(value = "/api/glass/file/deleteByBusinessId/{businessId}",method = RequestMethod.GET)
    RequestBody deleteByBusinessId(@PathVariable("businessId") String businessId);

    @RequestMapping(value = "/api/glass/file/getFileIdsByBusinessId/{businessId}",method = RequestMethod.GET)
    ResultBody<List<String>> getFileIdsByBusinessId(@PathVariable("businessId") String businessId);

    @RequestMapping(value = "/api/glass/file/getFileBusinessByIds",method = RequestMethod.POST)
    ResultBody<List<FileBusiness>> getFileBusinessByIds(@RequestBody List<String> businessIds);

    @RequestMapping(value = "/api/glass/file/uploadFiles",method = RequestMethod.POST,consumes= MediaType.MULTIPART_FORM_DATA_VALUE)
    ResultBody<List<String>> uploadFiles(@RequestPart("files") List<MultipartFile> files);

    @RequestMapping(value = "/api/glass/file/uploadFile",method = RequestMethod.POST,consumes= MediaType.MULTIPART_FORM_DATA_VALUE)
    ResultBody<String> uploadFile(@RequestPart("files") MultipartFile files);


    @RequestMapping(value = "/api/glass/file/getPreviewByBusinessParam",method = RequestMethod.POST)
    ResultBody<List<String>> getPreviewByBusinessParam(@RequestBody FileBusiness fileBusiness);

}
